package org.yzh.rbac.model.vo;

import java.util.List;

public class Permis implements Comparable<Permis> {

    private Integer id;

    private Integer pid;

    private String name;

    private String uri;

    private Integer sort;

    private int level;

    private List<Permis> list;

    public Permis() {
    }

    public Permis(Integer id, Integer pid, String name, Integer sort) {
        this.id = id;
        this.pid = pid;
        this.name = name;
        this.sort = sort;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public List<Permis> getList() {
        return list;
    }

    public void setList(List<Permis> list) {
        this.list = list;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Permis other = (Permis) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        return result;
    }

    @Override
    public int compareTo(Permis that) {
        int sort = Integer.compare(this.sort, that.sort);
        if (sort == 0)
            return Integer.compare(this.id, that.id);
        return sort;
    }
}